package router

import (
	"github.com/gin-gonic/gin"
)

// SetupRouter 负责设置所有路由
func SetupRouter(r *gin.Engine) {
	userGroup := r.Group("/api/v1/user")
	{
		userGroup.GET("/userinfo", getUserByID)
		userGroup.PUT("/userinfo", updateUser)
		userGroup.DELETE("/userinfo", deleteUser)
		userGroup.GET("/users", getUsers)
		userGroup.POST("/login", login)
		userGroup.POST("/register", createUser)
	}
	deviceGroup := r.Group("/api/v1/device")
	{
		deviceGroup.GET("/list", getDeviceList)
		deviceGroup.POST("/create", createDevice)
		deviceGroup.PUT("/update", updateDevice)
		deviceGroup.DELETE("/delete", deleteDevice)
		deviceGroup.GET("/:id", getDevice)
		deviceGroup.GET("/logs/list", getDeviceLogs)
		deviceGroup.GET("/list/search/:filter", searchDevice)
		deviceGroup.GET("/status", getDeviceStatus)
	}
}
